package com.pet.controller.admin;

import com.pet.pageDto.PetAdoptApplicationPageDTO;
import com.pet.pageDto.PetAdoptPageDTO;
import com.pet.pageDto.PetHealthPageDTO;
import com.pet.pageDto.UserInfoPageDTO;
import com.pet.result.PageResult;
import com.pet.result.Result;
import com.pet.service.PetAdoptApplicationService;
import com.pet.service.PetAdoptService;
import com.pet.service.PetHealthInformationService;
import com.pet.service.UserInformationService;
import com.pet.vo.system.data.SystemDataDailyVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * 后台数据管理
 */
@RestController
@RequestMapping("/admin/common")
@Slf4j
public class SystemSelectController {

    @Autowired
    private PetHealthInformationService petHealthInformationService;
    @Autowired
    private PetAdoptService petAdoptService;
    @Autowired
    private UserInformationService userInformationService;
    @Autowired
    private PetAdoptApplicationService petAdoptApplicationService;

    /**
     * 管理端： 分组查询所有宠物健康信息 使用PageResult
     */
    @PostMapping("/petHealthInformationAll")
    public Result<PageResult> pageInvitation(@RequestBody PetHealthPageDTO page){
        PageResult pageResult = petHealthInformationService.pageQuery(page);
        return Result.success(pageResult);
    }

    /**
     * 管理端：分组查询 获取所有领养申请 使用PageResult
     */
    @PostMapping("/petAdoptInformationAll")
    public Result<PageResult> petAdoptInformationAll(@RequestBody PetAdoptPageDTO page){
        PageResult pageResult = petAdoptService.pageQueryAdmin(page);
        return Result.success(pageResult);
    }

    /**
     * 管理端：分组查询 获取所有用户信息 使用PageResult
     */
    @PostMapping("/userInformationAll")
    public Result<PageResult> userInformationAll(@RequestBody UserInfoPageDTO page){
        PageResult pageResult = userInformationService.pageUserInformationAll(page);
        return Result.success(pageResult);
    }

    /**
     * 管理员：分页查询 获取指定送养信息对应的申请信息 使用PageResult
     */
    @PostMapping("/petAdoptApplicationInfo")
    public Result<PageResult> petAdoptApplicationInfo(@RequestBody PetAdoptApplicationPageDTO page){
        PageResult pageResult = petAdoptApplicationService.PetAdoptApplicationInfoPage(page);
        return Result.success(pageResult);
    }



}
